<template>
	<view class="page">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex aboutUs_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-center justify-between aboutUs_fd0_0'>
				<view class='flex flex-wrap align-center aboutUs_fd0_0_c0'>
					<!-- <image class='aboutUs_fd0_0_c0_c0' mode="aspectFill" :src='STATIC_URL+"90.png"'></image> -->
				</view>
				<text class='aboutUs_fd0_0_c1'>资料</text>
				<view class='flex align-center justify-end aboutUs_fd0_0_c2'>
				</view>
			</view>
		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---flex布局flex布局开始-->
		<view class="information_view">
			<view class="information_tabs">
				<u-tabs :list="tabsList" :is-scroll="true" font-size="32" inactive-color="#333333" active-color="#0052B5" name="fenleimingcheng" bar-width="60" :current="current" @change="change"></u-tabs>
			</view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#1593FF"></u-loading>
				<view>加载中</view>
			</view>
			<template v-else>
				<view class="information_list">
					<template v-for="(item, index) in list">
						<information :item="item"></information>
					</template>
					
				</view>
				<view class="loadmore" v-if="last_page > 1">
					<u-loadmore font-size="24" :status="status" :icon-type="iconType" :load-text="loadText" />
				</view>
				<view class="noData" v-if="list.length == 0 && !isShow">
					<image :src='STATIC_URL+"no.png"'></image>
				</view>
			</template>
		</view>

	</view>
</template>
<script>
	import information from "@/components/information/index.vue"
	export default {
		components: {
			information
		},

		data() {
			return {
				tabsList: [],
				current: 0,
				list: [],
				"page": 1,
				"is_pull": true,
				"last_page": 1,
				"status": 'loadmore',
				"iconType": 'flower',
				"loadText": {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '我也是有底线的'
				},
				"isShow": true,
			};
		},
		computed: {
			
		},
		watch: {},
		onLoad(options) {
			this.getCourseType();
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			
		},
		onHide() {

		},
		onResize() {

		},
		// 下拉刷新
		onPullDownRefresh() {
			this.page = 1;
			this.is_pull = true;
			this.isShow = true;
			this.getVideoList();
		},
		// 上拉加载
		onReachBottom() {
			if (this.page >= this.last_page) return;
			this.status = 'loading';
			this.page++;
			setTimeout(() => {
		
				if (this.page >= this.last_page) this.status = 'nomore';
				else this.status = 'loading';
				this.is_pull = false;
				this.getVideoList();
			}, 500)
		},
		onPageScroll(e) {

		},
		methods: {
			// 课程分类  post65a7ca7c457ea
			getCourseType() {
				this.$api.post(global.apiUrls.post65a7ca7c457ea, {
					
				}).then(res => {
					if (res.data.code == 1) {
						this.tabsList = res.data.data;
						if (this.tabsList.length > 0) {
							this.getVideoList();
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			// 获取视频列表  post65a87a15d60aa
			getVideoList() {
				this.$api.post(global.apiUrls.post65a87a15d60aa, {
					freekechengfenlei_id: this.tabsList[this.current].aid,
					page: this.page
				}).then(res => {
					uni.stopPullDownRefresh();
					this.isShow = false;
					// console.log(res);
					if (res.data.code == 1) {
						this.last_page = res.data.data.last_page;
						if (this.is_pull) {
							this.list = res.data.data.data;
						} else {
							this.list = this.list.concat(res.data.data.data);
						}
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			change(index) {
				this.current = index;
				this.page = 1;
				this.is_pull = true;
				this.isShow = true;
				this.getVideoList();
			}
		}
	};
</script>
<style lang="scss" scoped>
	.information_view {
		// padding: 0 32rpx;
		.information_tabs {
			height: 80rpx;
			width: 100%;
			position: fixed;
			z-index: 10;
		}
	
		.information_list {
			padding: 80rpx 32rpx 24rpx;
		}
	}
	.aboutUs_fd2_0 {
		color: #BFBFBF;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
		white-space: pre-wrap;
		margin: 0rpx 0rpx 8rpx 0rpx;
	}

	.aboutUs_fd2_1 {
		color: #BFBFBF;
		font-size: 28rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.aboutUs_flex_2 {
		width: 750rpx;
		height: 90rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(80rpx + var(--window-bottom));
	}

	.aboutUs_fd1_0 {
		width: 180rpx;
		height: 180rpx;
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		margin: 90rpx 0rpx 0rpx 0rpx;
	}

	.aboutUs_fd1_1 {
		margin: 32rpx 0rpx 0rpx 0rpx;
	}

	.aboutUs_fd1_1_c0 {
		font-weight: 400;
		color: #333333;
		font-size: 28rpx;
		line-height: 40rpx;
	}

	.aboutUs_fd1_1_c1 {
		font-weight: 400;
		color: #fff;
		font-size: 28rpx;
		line-height: 40rpx;
	}

	.aboutUs_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
	}

	.aboutUs_fd0_0_c0 {
		width: 40rpx;
		height: 40rpx;
	}

	.aboutUs_fd0_0_c0_c0 {
		width: 18rpx;
		height: 32rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
	}

	.aboutUs_fd0_0_c1 {
		font-size: 36rpx;
		font-weight: 500;
		color: #fff;
		line-height: 50rpx;
	}

	.aboutUs_fd0_0_c2 {
		width: 40rpx;
		height: 40rpx;
	}

	.aboutUs_flex_0 {
		background: #1593FF;
		background-size: 100% !important;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.page {
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}
</style>
